package com.bms.hystrix.controller.jxgl;

import com.bms.hystrix.pojo.YiJiPingLun;
import com.bms.hystrix.service.jxgl.YiJiPingLunService;
import io.swagger.annotations.*;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author zhangyujin
 * @version 1.0
 * @description YiJiPingLunController.java
 * @date 2021/3/25 9:24
 */
@RestController
@RequestMapping("yiJiPingLun")
@Api(value = "(YiJiPingLun)管理", tags = "(YiJiPingLun)管理接口API")
@ApiResponses({
        @ApiResponse(code = 400, message = "请求参数不完整或者错误"),
        @ApiResponse(code = 404, message = "找不到页面"),
        @ApiResponse(code = 405, message = "请求方式不正确，比如后台接收是post，但前端请求的是get"),
        @ApiResponse(code = 406, message = "页面地址和接口名冲突"),
        @ApiResponse(code = 415, message = "请求格式不正确，前端可能没有把请求头修改为json，也可能前端请求的json对象没有转换为字符串"),
        @ApiResponse(code = 500, message = "后台服务逻辑错误")
})
public class YiJiPingLunController {
    @Resource
    private YiJiPingLunService yiJiPingLunService;

    @RequestMapping(value = "chaXunById",method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Map chaXunById(@RequestParam String id,@RequestParam Integer page) {
        return this.yiJiPingLunService.chaXunById(id,page);
    }

    @RequestMapping(value = "xinZeng", method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes ="application/json")
   public Map<String, Object> xinZeng(@RequestBody YiJiPingLun yiJiPingLun) {
        System.out.println("yiJiPingLun:"+yiJiPingLun.toString());
        return this.yiJiPingLunService.xinZeng(yiJiPingLun);
    }

    @RequestMapping(value = "shanChuByIdAndShiPingId", method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Map<String, Object> shanChuById(@RequestParam String shanChuByIdAndShiPingId,@RequestParam String id) {
        return this.yiJiPingLunService.shanChuById(shanChuByIdAndShiPingId,id);
    }

    @RequestMapping(value = "chaxXunByTiaoJian", method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Map<String, Object> chaxXunByTiaoJian(String name) {
        return this.yiJiPingLunService.chaxXunByTiaoJian(name);
    }

    @RequestMapping(value = "chaXunByYiPingLunId",method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Map<String, Object> chaXunByYiPingLunId( String id) {
        System.out.println(id);
        return this.yiJiPingLunService.chaXunByYiPingLunId(id);
    }
}
